package coding.song;

import java.io.Serializable;
import java.util.Objects;

/**
 * @创建人 xfliu
 * @创建时间 2021/9/15
 * @描述 歌曲
 */
public class Song implements Serializable {
    private String name; // 歌曲名称
    private int id; //歌曲id
    private  boolean flag =false; //音乐播放状态
    private String treadName=null; //线程名字

    public String getTreadName() {
        return treadName;
    }

    public void setTreadName(String treadName) {
        this.treadName = treadName;
    }

    public boolean isFlag() {
        return flag;
    }

    public synchronized void setFlag(boolean flag) {
        this.flag = flag;
    }

    public Song(String name, int id){
        this.setId(id);
        this.setName(name);
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Override
    public String toString() {
        return "Song{" +
                "name='" + name + '\'' +
                ", id=" + id +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Song song = (Song) o;
        return id == song.id && Objects.equals(name, song.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, id);
    }
}
